<template>
	<view class="stu_container">
		<view class="stu_box">
			<view class="stu_item">
				<text class="stu_left">机构名称：</text>
				<text class="stu_right">{{schoolName}}</text>
			</view>
			<view class="stu_item">
				<text class="stu_left">学生姓名：</text>
				<text class="stu_right">{{empName}}</text>
				<!-- <input v-model="stuName" style="padding: 10rpx 0 10rpx 10rpx;width: 440rpx;" placeholder-class="account-txt" class="uni-input stu_right" placeholder="请输入学生姓名" type="text" /> -->
			</view>
			<view class="stu_item">
				<text class="stu_left">学生身份证：</text>
				<text class="stu_right">{{idCard}}</text>
				<!-- <input v-model="stuID" style="padding: 10rpx 0 10rpx 10rpx;width: 440rpx;" placeholder-class="account-txt" class="uni-input stu_right" placeholder="请输入学生身份证" type="text" /> -->
			</view>
		</view>
		<view class="btns">
			<button type="primary" class="btn_pri" style="background-color: #477EDA;" @click="q_submit">确认提交</button>
		</view>
		<mcModal :isShow="showMcModal" :content="content" :title="title" @cancel='bb()' :inp="false" @ok='cc()' :okBtn='okBtn'></mcModal>
	</view>
</template>

<script>
	import {findUserByIdCard} from '../../common/api/index.js';
	import mcModal from '../../components/custom-modal/custom-modal.vue'
	export default {
		onLoad:function(option){
			this.schoolName = option.schName
			this.orgId = option.orgId
			this.empName = option.empName
			this.idCard = option.idCard
			this.obj = {...JSON.parse(decodeURIComponent(option.obj))}
		},
		components: {
			mcModal
		},
		data() {
			return {
				schoolName: '',
				orgId: '',
				empName: '',
				idCard: '',
				obj: {},
				stuName: '',
				stuID: '',
				stuObj: {},
				showMcModal: false,
				content: '',
				title: '',
				okBtn: ''
			}
		},
		methods: {
			bb() {
				this.showMcModal = false
			},
			cc() {
				this.showMcModal = false
			},
			q_submit() {
				findUserByIdCard({
					idCardNo: this.idCard,
					orgId: this.orgId,
					empName: this.empName
				}).then(res => {
					if(res.code == 0) {
						let _this = this;
						this.stuObj = res.data;
						uni.navigateTo({
							url: './payment?obj=' + encodeURIComponent(JSON.stringify(_this.obj)) + '&stuObj=' + encodeURIComponent(JSON.stringify(res.data))
						})
					} else {
						this.title = '温馨提示'
						this.content = `您好，${res.msg}！`
						this.okBtn = '确认'
						this.showMcModal = true
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
	}
	.stu_container {
		padding: 50rpx;
		background-color: #FFFFFF;
	}
	.stu_box {
		display: flex;
		flex-direction: column;
	}
	.stu_item {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-bottom: 20rpx;
	}
	.stu_item:last-child {
		margin-bottom: 0;
	}
	.account-txt {
		font-size: 24rpx;
	}
	.stu_left {
		display: flex;
		flex: 0 0 200rpx;
		justify-content: flex-end;
		font-family: "PingFangSC";
		font-weight: 400;
		font-size: 32rpx;
		color: rgb(16, 16, 16);
	}
	.stu_right {
		display: flex;
		flex: 1;
		font-family: "PingFangSC";
		font-weight: 400;
		font-size: 28rpx;
		color: rgba(87, 86, 85, 1);
	}
	.btns {
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #FFFFFF;
		padding-top: 100rpx;
	}
	.btn_pri {
		border-radius: 30rpx;
		width: 70%;
		height: 70rpx;
		text-align: center;
		line-height: 70rpx;
		color: #FFFFFF;
		box-shadow: rgba(25, 94, 215, 0.4) 0px 4px 6px 1px;font-size: 24rpx;
	}
	.uni-input {
		border: 0.1px solid rgba(0, 0, 0, 0.1);
	}
</style>
